package com.example.activiti7.domain.service;

import com.example.activiti7.domain.model.req.QueryProcessInstanceListReq;
import com.example.activiti7.domain.model.req.StartInstanceReq;
import com.example.activiti7.domain.model.resp.Page;
import com.example.activiti7.domain.model.resp.Response;
import com.example.activiti7.domain.model.vo.HistoricProcessInstanceVO;
import com.example.activiti7.domain.model.vo.ProcessInstanceVO;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

public interface ProcessInstanceService {
    /**
     * 根据流程定义ID启动流程
     *
     * @param req 启动流程实例对象
     * @return
     */
    Response<ProcessInstanceVO> start(StartInstanceReq req);

    /**
     * 预览流程图
     *
     * @param response
     * @param processInstanceId
     * @throws IOException
     */
    void previewDiagram(HttpServletResponse response, String processInstanceId) throws IOException;
    /**
     * 根据流程实例ID删除流程实例
     *
     * @param processInstanceId
     * @return
     */
    Response<Boolean> deleteByProcessInstanceID(String processInstanceId);

    /**
     * 获取流程流程历史日志信息
     *
     * @param processDefinitionId
     * @return
     */
    Response<List<HistoricProcessInstanceVO>> queryHisByProcessDefinitionId(String processDefinitionId);

    /**
     * 根据条件查询流程实例列表
     *
     * @param req
     * @return
     * @throws Exception
     */
    Response<Page<ProcessInstanceVO, QueryProcessInstanceListReq>> queryProcessInstances(QueryProcessInstanceListReq req) throws Exception;
}
